package cn.wolfcode.wolf2w.domain;

import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 区域类
 */
@Setter
@Getter
@Document("destination_region")//d对应数据库的这个表,找到它
public class Region extends BaseDomain {
    public static final int STATE_HOT = 1;//状态 火热
    public static final int STATE_NORMAL = 0;

//id是字符串,已经有了,在父类
    private String name;        //地区名
    private String sn;          //地区编码
    private List<String> refIds = new ArrayList<>();     //关联的目的地表id
    private int ishot = STATE_NORMAL;         //状态    是否为热点
    private int sequence;   //序号
    private String info;  //简介

//编辑回显,编辑设置对象id提交
    public String getJsonString(){
        Map<String, Object> map = new HashMap<>();
        map.put("id",id);
        map.put("name",name);
        map.put("sn",sn);
        map.put("refIds",getRefIds());
        map.put("ishot",ishot);
        map.put("sequence",sequence);
        map.put("info",info);
        return JSON.toJSONString(map);
    }
}
